package day8;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

/**
 * @author oldliu
 * @since 1.0
 */
public class INputTest8 {
    public static void main(String[] args) {
//        File f=new File("E:\\迅雷下载\\cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso");
//        System.out.println(f.length()+"字节");
//        try {
//            FileInputStream fin=new FileInputStream(f);
//            System.out.println("availbe："+fin.available());
//            fin.close();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }

        try {
            InputStream in = new FileInputStream("E:\\temp\\java78\\2.txt");
            //大文件不合适
            byte[] b = new byte[in.available()];//多少块砖，多大的筐

            int length = in.read(b);//amazing
            String str = new String(b, 0, length);
            System.out.println(str);
            in.close();
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
